﻿@namespace SwashbucklerDiary.Components
@inherits MyComponentBase

<MHover>
    <MCard @attributes="context.Attrs"
           @oncontextmenu="()=>ShowMenu=true"
           Class="@($"diary-card {(context.Hover?"elevation-sm-2":"")} {Class}")"
           OnClick="ToRead"
           Elevation="0"
           Ripple="false"
           Rounded="@("lg")"
           __internal_preventDefault_oncontextmenu>
        <MListItem Dense>
            <MListItemContent>
                <div class="d-flex align-center">
                    <span class="text--secondary mr-3" style="font-size:1.1rem;">
                        @(Time.ToString(DateFormat))
                    </span>
                    @if (ShowIcon)
                    {
                        <DiaryCardIcon Value="@WeatherIcon" />
                        <DiaryCardIcon Value="@MoodIcon" />
                    }
                </div>
            </MListItemContent>
            <MListItemAction>
                @if (IsTop)
                {
                    <MIcon>
                        mdi-format-vertical-align-top
                    </MIcon>
                }
                <div @onclick:stopPropagation="true">
                    <MultiMenu @bind-Value="ShowMenu"
                               DynamicListItems="MenuItems">
                        <ButtonContent>
                            <MIcon Class="@($"chevron-down {(ShowMenu?"chevron-down-rotate-x":"")}")">
                                mdi-chevron-down
                            </MIcon>
                        </ButtonContent>
                    </MultiMenu>
                </div>
            </MListItemAction>
        </MListItem>
        <MDivider Class="mx-3"></MDivider>
        <MListItem ThreeLine>
            <MListItemContent>
                <div class="diary-card-title">
                    @(Title ?? I18n.T("Diary.Untitled"))
                </div>
                <MListItemSubtitle>
                    @Text
                </MListItemSubtitle>
            </MListItemContent>
        </MListItem>
    </MCard>
</MHover>
